package cn.training.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.training.bean.UserBean;
import cn.training.service.HelloWorldService;


@Controller("HelloWorldController")
@RequestMapping("/")
public class HelloWorldController {
	@Autowired
	HelloWorldService helloWorldService;

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String initLogin(Model model) {
        return "helloWorld";
    }
    @RequestMapping(value="/init",method = RequestMethod.POST)
    public String initLogin(UserBean userbean,Model model)
    {
  
		UserBean result= helloWorldService.searchUser(userbean);
    	model.addAttribute("userbean",result);
    	return "login";
    	
    }
    
}
